package com.airticketbooking.mapper;

import com.airticketbooking.po.Member;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;


import java.util.Date;

/**
 * @author Mr.J
 * @version 1.0.0
 * @date 2024/11/13
 * @desc
 */
@Mapper
public interface MemberMapper {

	@Select("SELECT * FROM airticketbooking.member" +
			" WHERE" +
			" user_id = #{userId}")
	Member getByUserId(Integer userId);

	@Update("UPDATE airticketbooking.member SET level_id = #{levelId}" +
			" WHERE" +
			" member_id = #{memberId}")
	void ModifyLevel(Integer memberId, Integer levelId);


	@Select("SELECT * FROM airticketbooking.member WHERE member_id = #{memberId}")
	Member getById(Integer memberId);

	void add(Member member);

	@Select("SELECT COUNT(*) FROM airticketbooking.member")
	Integer getAllMembers();

	Integer getMembersNumInRangeTime(Date startTime, Date endTime);
}
